package org.meb.conquest.db.model;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Version;

import org.hibernate.annotations.Type;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;

@Getter
@Setter
@NoArgsConstructor
@ToString(includeFieldNames = true)
@Entity
@Table(name = "cqt_user")
public class User {

	private Date signUpDate;
	private Date signInDate;
	private String timeZoneId;
	private String name;
	private String email;
	private String hash;
	private String salt;
	
	@Type(type = "org.hibernate.type.YesNoType")
	private Boolean active = Boolean.TRUE;
	private String activationCode;
	private Long twitterId;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;

	@Version
	private Long version;

	public User(Long id) {
		this.id = id;
	}
	
	public User(String name) {
		this.name = name;
	}
	
	public User(String name, Boolean active) {
		this.name = name;
		this.active = active;
	}
	
	public User(String name, String email, String hash, String salt) {
		this.name = name;
		this.email = email;
		this.hash = hash;
		this.salt = salt;
	}
}
